<div class="full-screen">
  <header>
    <div class="a-bar">
      <a href="javascript:history.back()" class="a-back"><i class="arr left"></i>返回</a>
      <div class="a-name">注册</div>
      <div class="a-right">
        <a href="<{link app=b2c ctl=wap_passport act=login}>" class="btn orange">登录</a>
      </div>
    </div>
  </header>
  <div class="full-padding">
    <form action="<{link app=b2c ctl=wap_passport act=create args01=$next_url}>" method="post" class="form" enctype="multipart/form-data" encoding="multipart/form-data" target="_self"> 
      <input name="forward" type="hidden" value="<{$options.url}>">
      <input name="mini" type="hidden" value="<{$mini_passport}>">

      <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>登录帐号：
        </label>
        <div class="c">
         <input type="text" style = "width:200px;" name="pam_account[login_name]" id="username" onblur="action_usernane()" class="action-account-check" placeholder="用户名/邮箱/手机号，最少4个字符" vtype="required" data-caution="请填写登录帐号，最少4个字符" autofocus required="required" \>
        </div>
      </div>
      <!--add by lkb 注册账号验证-->
      <div id="username_tips" style="display:none;" class="username_tips"></div>
      <!--add end-->

       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>密码：
        </label>
        <div class="c">
          <input type="password" name="pam_account[login_password]" maxlength="20" placeholder="6-20个字符" vtype="required&&minLength:6&&maxLength:20" data-caution="请填写密码，6-20个字符&&输入不正确，最少6个字符&&输入不正确，最多20个字符" check='true' required="required" onblur="action_login_password()" id="login_password">
        </div>
      </div>
      <!--add by lkb 注册密码验证-->
      <div id="login_password_tips" style="display:none;" class="login_password_tips"></div>
      <!--add end-->
      
       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>重复密码：
        </label>
        <div class="c">
          <input type="password" name="pam_account[psw_confirm]" id="psw_confirm" class="x-input" maxlength="20" placeholder="再次填写密码" vtype="equal:pam_account[login_password]" data-caution="密码与确认密码不相符，请重新填写" required="required" onblur="action_psw_confirm()" >
        </div>
      </div>
       <!--add by lkb 注册重复密码-->
      <div id="psw_confirm_tips" style="display:none;" class="psw_confirm_tips"></div>
      <!--add end-->
      
       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>法人姓名：
        </label>
        <div class="c">
          <input type="text" name="frname" id="frname" placeholder="法人姓名" required="required" onblur="action_frname()" >
        </div>
      </div>
      <!--add by lkb 注册法人姓名验证-->
      <div id="frname_tips" style="display:none;" class="frname_tips"></div>
      <!--add end-->
      
       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l" style="width: 96px;">
           <em class="f-red">*</em>法人身份证：
        </label>
        <div class="c">
          <input type="text" name="idnumber" id="idnumber"  placeholder="法人身份证号" required="required" onblur="action_idnumber()">
        </div>
      </div>
      <!--add by lkb 注册法人身份证验证-->
      <div id="idnumber_tips" style="display:none;" class="idnumber_tips"></div>
      <!--add end-->
      
       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>公司名：
        </label>
        <div class="c">
          <input type="text" name="gcname" id="gcname" placeholder="公司名" required="required" onblur="action_gcname()">
        </div>
      </div>
       <!--add by lkb 注册公司名验证-->
      <div id="gcname_tips" style="display:none;" class="gcname_tips"></div>
      <!--add end-->
      
       

      
      <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l" style="width: 112px;">
          <em class="f-red">*</em>营业执照图片：
        </label>
        <div class="c" style="margin-left: 130px;">
         <input type="file" name="licensep" id="" accept="image/gif,image/jpg,image/jpeg,image/png" required="required">
         <br><span class="f-red">(分辨率不超过3500*3500，大小不超过4M)</span>
        </div>
      </div>
      
      <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l" style="width: 127px;text-align:left;padding:0;">
          <em class="f-red"></em>食品流通许可证：
        </label>
        <div class="c" style="margin-left: 130px;  ">
         <input type="file" name="permit" accept="image/gif,image/jpg,image/jpeg,image/png" >
        </div>
      </div>
      
       <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l" style="width: 95px;">
          <em></em>推荐业务员：
        </label>
        <div class="c">
          <input type="text" name="salesman" id="salesman" onblur="action_salesman()">
        </div>
      </div>
      <!--add by lkb 注册推荐业务员验证-->
      <div id="salesman_tips" style="display:none;" class="salesman_tips"></div>
      <!--add end-->


      <div class="notice"></div>
         <div class="c-g">
        <label for="" class="c-l">
          <em class="f-red">*</em>联系电话：
        </label>
        <div class="c">
          <input type="text" name="contact[phone][telephone]" id="telephone" placeholder="联系电话"  required="required" onblur="action_telephone()">
        </div>
      </div>
      <!--add by lkb 注册联系电话验证-->
      <div id="telephone_tips" style="display:none;" class="telephone_tips"></div>
      <!--add end-->
      
      <div class="notice"></div>
        <{if $site_sms_valide == 'true'}>
        <div class="c-g">
            <label class="c-l">
                <em class="f-red">*</em>验证码：</label>
            <div class="c" style="margin-left: 90px;">
                <{input type="vcode" name="signupverifycode" class="verify-input" placeholder="填写验证码" data-caution="请正确填写验证码" key='LOGINVCODE' a_class="lnklike" style="width: 75px;" label='换一张' oninput="check_code()"}>
            </div>
        </div>
<div id="vcode_tips" style="display:none;"><p style="position:relative;left:28px;top:-30px;color:red;font-size:.24rem;">验证码填写错误</p></div>
        <{/if}>
       <div id='sms' class="c-g action-need-verify" style="display: none">
      <label for="" class="c-l">
          <em class="f-red">*</em>短信验证：
        </label>
        <div class="c">
          <input type="password" name="pam_account[login_verification]" maxlength="20" placeholder="请输入短信验证码" pattern=".{4,6}" class="text" data-caution="短信验证码不能为空">
          	<a href="<{link app=b2c ctl=wap_passport act=send_vcode_sms}>" class="btn btn-send orange ib-btn">获取验证码</a>
        </div>
    </div>
        
      <div class="notice"></div>
      <div class="c-g-c">
        <input type="checkbox" name="license" id="license" checked="checked">
        <label for="license">
          <{t}>同意<a href="<{link app=b2c ctl=wap_passport act=license}>" class="license lnk">注册协议</a><{/t}>
        </label>
      </div>
      <div class="btn-bar">
       <span class="form-act"> <button type="submit" label=$__b2c=$label|t:'b2c' rel="_request" class="btn orange" >注册</button></span>
      </div>
    </form>
  </div>
</div>

<script type="text/javascript">

    $(function () {
        var url=$("a.verify-code").attr("href");
        $("a.verify-code").attr("href",null);

        $("a.verify-code").bind("click",function () {
            var xhr = new XMLHttpRequest();
            xhr.open("GET",url,true);
            xhr.responseType = "blob";
            xhr.onload=function () {
                if(this.status==200){
                    var blob=this.response;
                    console.log(blob);
                    var img = document.createElement("img");
                    var _src=window.URL.createObjectURL(blob);
                    $("img.verify-code").attr("src",_src);
                }
            };
            xhr.send();
        })

        $("button").on("click",function () {
            $(this).attr("type","button");
            $form=$(this).parents("form");
            $form.submit();
        })
    });
//add by lkb 2017-05-19 
//验证账号
function action_usernane(){
	var u1=document.getElementById('username');
	var s1=/^1[34578]{1}[0-9]{9}$/;
	if (s1.test(u1.value))
		{	
			document.getElementById('sms').style.display="";
		}else{
			document.getElementById('sms').style.display="none";
		}


    var username=document.getElementById('username').value;
//var btn1=document.getElementsByClassName('btn orange')[2];
var username_tips=document.getElementById('username_tips');
$('.username_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_username}>','username='+username,function(re){
    if(re){
      //alert(re);
      //btn1.disabled="disabled";
      $('.username_tips').html(re);
      username_tips.style.display="";
      return;
    }
            });
//btn1.disabled="";
username_tips.style.display="none";
}	


//验证密码
function action_login_password(){
    var login_password=document.getElementById('login_password').value;

var login_password_tips=document.getElementById('login_password_tips');
$('.login_password_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_login_password}>','login_password='+login_password,function(re){
    if(re){
      $('.login_password_tips').html(re);
      login_password_tips.style.display="";
      return;
    }
            });
login_password_tips.style.display="none";
} 
//验证密码
function action_psw_confirm(){
    var psw_confirm=document.getElementById('psw_confirm').value;
    var login_password=document.getElementById('login_password').value;

var psw_confirm_tips=document.getElementById('psw_confirm_tips');
$('.psw_confirm_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_psw_confirm}>','login_password='+login_password+'&psw_confirm='+psw_confirm,function(re){
    if(re){
      $('.psw_confirm_tips').html(re);
      psw_confirm_tips.style.display="";
      return;
    }
            });
psw_confirm_tips.style.display="none";
} 


//验证法人姓名
function action_frname(){
    var frname=document.getElementById('frname').value;

var frname_tips=document.getElementById('frname_tips');
$('.frname_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_frname}>','frname='+frname,function(re){
    if(re){
      $('.frname_tips').html(re);
      frname_tips.style.display="";
      return;
    }
            });
frname_tips.style.display="none";
} 

//验证法人身份证
function action_idnumber(){
    var idnumber=document.getElementById('idnumber').value;

var idnumber_tips=document.getElementById('idnumber_tips');
$('.idnumber_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_idnumber}>','idnumber='+idnumber,function(re){
    if(re){
      $('.idnumber_tips').html(re);
      idnumber_tips.style.display="";
      return;
    }
            });
idnumber_tips.style.display="none";
} 

//验证公司名称
function action_gcname(){
    var gcname=document.getElementById('gcname').value;

var gcname_tips=document.getElementById('gcname_tips');
$('.gcname_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_gcname}>','gcname='+gcname,function(re){
    if(re){
      $('.gcname_tips').html(re);
      gcname_tips.style.display="";
      return;
    }
            });
gcname_tips.style.display="none";
} 


//验证推荐业务员
function action_salesman(){
    var salesman=document.getElementById('salesman').value;

var salesman_tips=document.getElementById('salesman_tips');
$('.salesman_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_salesman}>','salesman='+salesman,function(re){
    if(re){
      $('.salesman_tips').html(re);
      salesman_tips.style.display="";
      return;
    }
            });
salesman_tips.style.display="none";
} 



//验证联系电话
function action_telephone(){
    var telephone=document.getElementById('telephone').value;

var telephone_tips=document.getElementById('telephone_tips');
$('.telephone_tips').html('');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_telephone}>','telephone='+telephone,function(re){
    if(re){
      $('.telephone_tips').html(re);
      telephone_tips.style.display="";
      return;
    }
            });
telephone_tips.style.display="none";
} 

//add end

//add by peter 2017-05-17 issue 308 验证码实时校验
function check_code(){
var vcode1=document.getElementsByName('signupverifycode')[0].value;
//var btn1=document.getElementsByClassName('btn orange')[2];
var vcode_tips=document.getElementById('vcode_tips');
$.post('<{link app=b2c ctl=wap_passport act=ajax_check_code}>','vcode='+vcode1,function(re){
		if(re){
			//alert(re);
			//btn1.disabled="disabled";
			vcode_tips.style.display="";
			return;
		}
            });
//btn1.disabled="";
vcode_tips.style.display="none";
}


</script>
